/* Pagination Controllor
—————————————————————————————————————————— */
function pagination (current, length) {
  const speaker = document.getElementById('speaker');
  const ol = document.createElement('ol');
  ol.classList.add('pagination-controllor');
  for (let i = 0; i < length; i++) {
    const li = document.createElement('li');
    li.setAttribute('data-index', i);

    const classLists = li.classList;
    classLists.add('pagination-item');
    if (i === current) {
      classLists.add('active');
    }
    ol.appendChild(li);
  }
  speaker.appendChild(ol);

  // Set Position
  const height = ol.offsetHeight;
  ol.style.marginTop = -height / 2 + 'px';

  return ol;
}

module.exports = pagination;
